#ifndef OWL_LAYER_H_
#define OWL_LAYER_H_
#include "common.h"
#include "activations.h"

struct NetworkState;

typedef struct Layer Layer;

typedef enum LayerType
{
	CONNECTED,
	COST
} LayerType;

typedef enum CostType
{
	SSE, MASKED, SMOOTH
} CostType;

struct Layer
{
	LayerType type;
	Activation activation;
	CostType cost_type;
	void (*Forward) (struct Layer, struct NetworkState);
	void (*Backward) (struct Layer, struct NetworkState);
	void (*Update) (struct Layer, int, float, float, float);

	int batch_normalize;
	int batch;
	int inputs;
	int outputs;
	int h;
	int w;
	int c;
	int out_h;
	int out_w;
	int out_c;

	// cost layer
	Float scale;
	Float *cost;

	Float *data_weights;
	Float *data_weight_updates;
	Float *data_biases;
	Float *data_bias_updates;
	Float *data_output;
	Float *data_delta;
	Float *data_scales;
	Float *data_scale_updates;
	Float *data_mean;
	Float *data_mean_delta;
	Float *data_variance;
	Float *data_variance_delta;
	Float *data_rolling_mean;
	Float *data_rolling_variance;
	Float *data_x;
	Float *data_x_norm;
};

void FreeLayer(Layer);
#endif //OWL_LAYER_H_
